{% extends "base.html" %}

{% block title %}添加用户{% endblock %}

{% block content %}
<div class="container-fluid">
    <!-- 页面标题 -->
    <div class="glass-card mb-4 p-3">
        <h1 class="h3 mb-0 page-title-glass">
            <i class="fas fa-user-plus mr-2"></i>添加用户
        </h1>
    </div>

    <div class="row justify-content-center">
        <div class="col-lg-8">
            <div class="glass-card card shadow">
                <div class="card-header py-3">
                    <h6 class="m-0 font-weight-bold text-primary">用户信息</h6>
                </div>
                <div class="card-body">
                    <form method="POST" action="{{ url_for('add_user') }}">
                        <div class="row">
                            <div class="col-md-6">
                                <div class="form-group">
                                    <label for="username" class="form-label">用户名</label>
                                    <input type="text" class="form-control" id="username" name="username" required>
                                </div>
                                
                                <div class="form-group">
                                    <label for="password" class="form-label">密码</label>
                                    <input type="password" class="form-control" id="password" name="password" required>
                                    <small class="form-text text-muted">密码长度不能少于6位</small>
                                </div>
                                
                                <div class="form-group">
                                    <div class="form-check">
                                        <input type="checkbox" class="form-check-input" id="is_admin" name="is_admin">
                                        <label class="form-check-label" for="is_admin">
                                            <i class="fas fa-crown me-1"></i>管理员权限
                                        </label>
                                    </div>
                                </div>
                            </div>
                            
                            <div class="col-md-6">
                                <h6 class="text-primary mb-3">功能权限设置</h6>
                                
                                <div class="form-group">
                                    <div class="form-check">
                                        <input type="checkbox" class="form-check-input" id="can_use_dingtalk" name="can_use_dingtalk" checked>
                                        <label class="form-check-label" for="can_use_dingtalk">
                                            <i class="fas fa-robot me-1"></i>钉钉消息任务模块
                                        </label>
                                    </div>
                                </div>
                                
                                <div class="form-group">
                                    <div class="form-check">
                                        <input type="checkbox" class="form-check-input" id="can_use_custom_tasks" name="can_use_custom_tasks" checked>
                                        <label class="form-check-label" for="can_use_custom_tasks">
                                            <i class="fas fa-tasks me-1"></i>用户自定义模块
                                        </label>
                                    </div>
                                </div>
                                
                                <div class="form-group">
                                    <div class="form-check">
                                        <input type="checkbox" class="form-check-input" id="can_manage_packages" name="can_manage_packages">
                                        <label class="form-check-label" for="can_manage_packages">
                                            <i class="fas fa-boxes me-1"></i>依赖项管理功能
                                        </label>
                                    </div>
                                </div>
                            </div>
                        </div>
                        
                        <div class="form-group mt-4">
                            <button type="submit" class="btn btn-primary">
                                <i class="fas fa-plus me-1"></i>添加用户
                            </button>
                            <a href="{{ url_for('user_management') }}" class="btn btn-secondary">
                                <i class="fas fa-arrow-left me-1"></i>返回
                            </a>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>

<style>
/* 液态玻璃风格补充 */
.glass-card {
    background: rgba(255,255,255,0.6) !important;
    backdrop-filter: blur(16px) !important;
    -webkit-backdrop-filter: blur(16px) !important;
    border: 1px solid rgba(255,255,255,0.2) !important;
    border-radius: 1rem !important;
    box-shadow: 0 8px 32px 0 rgba(31,38,135,0.10) !important;
    transition: all 0.3s cubic-bezier(0.4,0,0.2,1) !important;
}
.glass-card .card-header, .glass-card .card-body {
    background: transparent !important;
}
[data-theme="dark"] .glass-card {
    background: rgba(30,30,30,0.7) !important;
    border-color: rgba(255,255,255,0.1) !important;
}

/* 液态玻璃风格补充 */
.page-title-glass {
    color: #222 !important;
    transition: color 0.2s;
}
[data-theme="dark"] .page-title-glass {
    color: #fff !important;
}
</style>
{% endblock %}